#if !defined(ximera_input_ikeyboard_hpp)
#define ximera_input_ikeyboard_hpp

// -----------------------------------------------------------

#include <ximera/input/idevice.hpp>
#include <ximera/common/signal.hpp>
#include <ximera/input/codes.hpp>

namespace ximera { namespace input
{
    //! \brief Exception for Keyboard errors
    XIMERA_DECLARE_EXCEPTION_SUB(KeyboardException, DeviceException, L"Keyboard error");

    //! Interface that represents a Keyboard input device
    class XIMERA_API IKeyboard: public IDevice
    {
    public:
        /*! Defines the prototype of the event that will be called when a key is pressed on the keyboard device.
         *  \param sender It's the device where the key was pressed.
         *  \param keyCode It's the key that was pressed. */
        typedef void (OnKeyDownEvent)(IKeyboard* sender, KeyCode const& keyCode);

        /*! Defines the prototype of the event that will be called when a key is released on the keyboard device.
         *  \param sender It's the device where the key was released.
         *  \param keyCode It's the key that was released. */
        typedef void (OnKeyUpEvent)(IKeyboard* sender, KeyCode const& keyCode);

        virtual ~IKeyboard();

        /*! \brief Returns if the key is pressed.
         *
         *  Returns true if the key is pressed, otherwise returns false.
         *  \param keyCode Is the code of the key that is wanted 
         */
        virtual bool isKeyPressed(KeyCode const& keyCode);

        /*! Event that rises when a key is pressed to the keyboard. */
        Signal<OnKeyDownEvent>& onKeyDown();

        /*! Event that rises when a key is released to the keyboard. */
        Signal<OnKeyUpEvent>& onKeyUp();

    protected:

        Signal<OnKeyDownEvent> _onKeyDown;
        Signal<OnKeyUpEvent> _onKeyUp;
    };
}}

// -----------------------------------------------------------

#endif
